﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using BOSS.Framework.Search.UrlBuilder;

namespace BOSS.Framework.Search.Context
{
    /// <summary>
    /// 明确值型的过滤条件部分抽象类
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public abstract class TermValueFilterPart<T> : IFilterPart
    {
        /// <summary>
        /// 获取 / 设置 数值取值
        /// </summary>
        public T Value { get; set; }

        #region IQueryPart 成员

        /// <summary>
        /// 获取 字段名称
        /// </summary>
        public string FieldName { get; protected set; }

        /// <summary>
        /// 构造 URL
        /// </summary>
        /// <param name="urlBuilder"></param>
        public abstract void BuildUrl(IUrlBuilder urlBuilder);

        #endregion

        #region IFilterPart 成员

        /// <summary>
        /// 获取 过滤条件
        /// </summary>
        public virtual string Filter
        {
            get { return Convert.ToString(this.Value); }
        }

        #endregion
    }
}
